const Router = require('koa-router');
const tool = require("../../tools/tool");
const router = new Router();
const {db, Op, QueryTypes} = require("../../models/db");
const tools = require("../../tools/tool");
// 确认领取收款单据
router.post('/ldsk/confirmGetReceipt', async ctx => {
    let tid = ctx.user.tenantId
    let details = ctx.request.body
    let appdetails = []
    for (let i = 0; i < details.length; i++) {
        appdetails.push({
            tenantId: tid,
            billDate: tool.getDay(),
            billState: '收款中',
            doId: details[i].doId,
            billId: details[i].id,
            leftAmount: details[i].leftAmount,
            createdBy: ctx.user.id,
            createdAt: tool.getTime()
        })
    }
    await db.models['appSk'].bulkCreate(appdetails)
    return ctx.suc('领单成功')
})






module.exports = router;